package com.pd.business;

import redis.clients.jedis.Jedis;

import java.util.Map;
import java.util.Set;

/**
 * Created by dong peng on 2017/8/15.
 */
public class JedisTest {

    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.126.128",6379);
        jedis.set("foo", "bar");
        String value = jedis.get("foo");
        String name = jedis.get("name");

        Set set = jedis.keys("*");
        System.out.println(set);
        System.out.println(value);
        System.out.println(name);

        hset();
    }


    public static void hset() {
        Jedis jedis = new Jedis("192.168.126.128",6379);
        jedis.hset("myhash","name","li");
        jedis.hset("myhash","age","18");
        Map map = jedis.hgetAll("myhash");
        System.out.println(map);
    }
}
